/**
 * Created by lihao on 2017-05-26.
 */
var app = angular.module('myApp', []);

app.run(function($templateCache) {
    $templateCache.put("zippy.html", '<div><h3 ng-click="toggleContent()">{{title}}</h3><div ng-show="isContentVisiable" ng-transclude></div></div>')
});

app.directive('zippy',function (/*$templateCache*/) {
    //console.log($templateCache.get("zippy.html"));
    return {
        restrict:'E',
        transclude:true,
        scope:{
            title:'@'
        },
        templateUrl:'zippy.html',
        //templateUrl:'../node/templateUrl-zippy.html',
        //template: $templateCache.get("zippy.html");
        link: function(scope) {
            scope.isContentVisiable = false;
            scope.toggleContent = function() {
                scope.isContentVisiable = !scope.isContentVisiable;
            };
        }
    }
})